package com.atguigu.datastream.test.day03;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * ClassName: Flink_01_Source_Colletion
 * Package: com.atguigu.test.day03
 * Description:
 *
 * @Author ChenJun
 * @Create 2023/4/9 19:00
 * @Version 1.0
 */
public class Flink_01_Source_Collection {
    public static void main(String[] args) throws Exception {

        //1 创建flink 的流式环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //2. 设置并行都
        env.setParallelism(1);

        //3. 从集合读取数据
        List<Integer> list = Arrays.asList(1, 2, 4, 5, 6, 7, 8, 7, 13, 2);

        DataStreamSource<Integer> streamSource = env.fromCollection(list);

        //4. 打印
        streamSource.print();

        //5. 执行
        env.execute();

    }
}
